package com.soso.dao;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.soso.entity.Roles;
import com.soso.entity.Users;

public interface RolesDao extends JpaRepository<Roles, String>,JpaSpecificationExecutor<Roles> {

	//查询所有
	@Query(value="select * from roles where id=?1",nativeQuery = true)
	 public Roles getallroles(String id);
	
@Query(value="select * from roles",nativeQuery = true)
public List<Roles> getroles();

@Transactional
@Modifying
@Query(value="insert into roles(Id,Name) values(?1,?2)",nativeQuery=true)
int adda(String Id,String name);

//删除中间表
@Transactional
@Modifying
@Query(value="DELETE FROM rolemodules WHERE rolemodules.RoleId=?1",nativeQuery=true)
Integer deleteromoid(String aa);
//删除角色表
@Transactional
@Modifying
@Query(value="DELETE from roles WHERE roles.Id=?1",nativeQuery=true)
Integer deletero(String bb);
	
	
	

}
